<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<title>[%$ESPCMS_SOFT_TITLE%]</title>
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_style_font_icon.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_style_public.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_all.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_style_font_icon.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_framework.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/espcms_select.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/upload_file.css" rel="stylesheet" type="text/css" />
		<link href="[%$ESPCMS_ADMIN_TEMPLATES_URL%]css/file.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/jquery.min.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/jquery-ui.min.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/jquery.cookie.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/md5.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/json.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/bootstrap.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/lngpack_cn.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_form.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_formvalidation.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_dialog.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_function.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_page.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_select.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_checkbox.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_select_checkbox.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_batch.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/iframeResizer.contentWindow.min.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_tab.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_rightkey.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/espcms_filetool.js"></script>
		<script type="text/javascript" src="[%ESPCMS_ADMIN_URL%]js/webuploader/webuploader.js"></script>
		<script type="text/javascript">
			var uploadSWF = '[%ESPCMS_ADMIN_URL%]js/webuploader/Uploader.swf';
			var upfileType = '[%$upfileType%]';
			var selectnum = '[%$selectnum%]';
			var upfile_ext = '[%$upfile_ext%]';
			var upload_max_filesize = '[%$net_upload_max_filesize%]';
			var upload_max_filesize_byte = '[%$upload_max_filesize_byte%]';
			var chunksize = '[%$chunksize%]';
			$('input[type=checkbox],input[type=radio]').espcms_checkbox();
			$(document).ready(function () {
				banpageKey();
				add_espcms_window_tab();
				dialog_diropen(0);

				$('.refresh').click(function () {
					var file_id = $('#filedir_id').val();
					dialog_diropen(file_id);
				});

				$('.espcms_list_type').click(function () {
					var listype = $(this).attr('data-type');
					espcms_list_type(listype);
				});

				$('.espcms_add_dir').click(function () {
					var addurl_val = '[%$link.adddir%]';
					var filedir_id = $('#filedir_id').val();
					var queryString = 'filedir_id=' + filedir_id;
					var tab_url = espcms_combine_url(queryString, addurl_val);
					var iframesName = window.frameElement.id;
					var tab_name = $(this).attr('tab_name');
					var tab_close = $(this).attr('tab_close');
					var tab_icon = $(this).attr('tab_icon');
					parent.click_espcms_window_tab(tab_name, tab_url, iframesName, tab_icon, tab_close);
				});

				$('.espcms_import_file').click(function () {
					var addurl_val = '[%$link.import%]';
					var filedir_id = $('#filedir_id').val();
					var queryString = 'filedir_id=' + filedir_id;
					var tab_url = espcms_combine_url(queryString, addurl_val);
					var iframesName = window.frameElement.id;
					var tab_name = $(this).attr('tab_name');
					var tab_close = $(this).attr('tab_close');
					var tab_icon = $(this).attr('tab_icon');
					parent.click_espcms_window_tab(tab_name, tab_url, iframesName, tab_icon, tab_close);
				});

				$('.espcms_check_file').click(function () {
					var filedir_id = $('#filedir_id').val();
					var dialog_html = '<div id="espcms_are_del_dialog" title="[%pack:public_pack-espcms_dialog_title%]" class="displaynone">' +
						'<p><span class="espcms_icon_fa espcms_icon_fa-exclamation-circle" style="float:left;margin:0 3px 0px 0;padding-top:4px;"></span>[%pack:filemanage_pack-espcms_filenamage_file_check_warning%]</p>' +
						'</div>';
					parent.$("body").append(dialog_html);

					var botton = [
						{
							text: "[%pack:filemanage_pack-espcms_filenamage_file_check_botton_ok%]",
							class: "btn btn-danger",
							click: function () {
								$.ajax({
									type: "get",
									url: '[%$link.check%]',
									dataType: 'json',
									beforeSend: function () {
										var file_id = $('#filedir_id').val();
										dialog_diropen(file_id);

									},
									success: function (data) {
										parent.$("#espcms_are_loading").dialog("close");
										parent.$.espcms_sticky(data.message, {'autoclose': 3500});
									}
								});
								parent.$(this).dialog("close");
							}
						},
						{
							text: "[%pack:filemanage_pack-espcms_filenamage_file_check_botton_no%]",
							class: "btn btn-lightgray",
							click: function () {
								parent.$(this).dialog("close");
							}
						}
					];
					parent.espcms_public_dialog('espcms_are_del_dialog', botton, 610);
					return false;
				});

				$('.espcms_del_file').click(function () {
					var select_id_list = $('#select_id_list').val();
					var select_filelist = $('#select_filelist').val();
					if (!select_id_list) {
						return false;
					}
					var dialog_html = '<div id="espcms_are_del_dialog" title="[%pack:public_pack-espcms_dialog_title%]" class="displaynone">' +
						'<p><span class="espcms_icon_fa espcms_icon_fa-exclamation-circle" style="float:left;margin:0 3px 0px 0;padding-top:4px;"></span>[%pack:public_pack-espcms_message_del_warning%]</p>' +
						'</div>';
					parent.$("body").append(dialog_html);
					var botton = [
						{
							text: "[%pack:botton_pack-espcms_botton_del_ok%]",
							class: "btn btn-danger",
							click: function () {
								$.ajax({
									type: "post",
									url: '[%$link.delfile%]',
									dataType: 'json',
									data: "file_id=" + select_id_list + "&filelist=" + select_filelist,
									beforeSend: function () {
										parent.espcms_are_loading();
									},
									success: function (data) {

										parent.$("#espcms_are_loading").dialog("close");
										parent.$.espcms_sticky(data.message, {'autoclose': 3500});
										var filedir_id = $('#filedir_id').val();
										dialog_diropen(filedir_id);

										$('#select_id_list').val('');
										$('#select_filelist').val('');
										$('#select_titlelist').val('');
										$('#select_sizelist').val('');
										$('#select_extlist').val('');
									}
								});
								parent.$(this).dialog("close");
							}
						},
						{
							text: "[%pack:botton_pack-espcms_botton_del_no%]",
							class: "btn btn-lightgray",
							click: function () {
								parent.$(this).dialog("close");
							}
						}
					];
					parent.espcms_public_dialog('espcms_are_del_dialog', botton);
					return false;
				});
			});

			function dialog_diropen(filedir_id) {
				var listurl = $('#listurl').val();
				var queryString = 'filedir_id=' + filedir_id + '&out_type=list';
				var loadingURL = espcms_combine_url(queryString, listurl);
				var dir_id = filedir_id ? filedir_id : 0;
				$('#listurl').val(loadingURL);
				$('#filedir_id').val(dir_id);

				var select_id_list = $('#select_id_list').val();
				var select_id_check_list;

				var select_id_name_array = new Array();

				var select_id_name_check_array = new Array();
				if (select_id_list) {

					var select_id_list_array = select_id_list.split(',');
					for (var i = 0; i <= select_id_list_array.length; i++) {
						if (select_id_list_array[i]) {

							select_id_name_array.push('#photoid_' + select_id_list_array[i]);
							select_id_name_check_array.push('#select_check_' + select_id_list_array[i]);
						}

					}

					select_id_list = select_id_name_array.join(',');
					select_id_check_list = select_id_name_check_array.join(',');
				}

				$.ajax({
					type: "get", url: loadingURL, global: false,
					beforeSend: function () {
						$('#loadingtable').show();
					},
					success: function (data) {
						$('#loadingtable').hide();
						$('#loadingstr').empty().append(data);
						$('input[type=checkbox],input[type=radio]').espcms_checkbox();

						if (select_id_name_array.length > 0) {
							$(select_id_list).addClass("espcms_fileupload_select");
							$(select_id_list).find('p.file_select_ok').show();
						}

						if (select_id_name_check_array.length > 0) {
							$(select_id_check_list).espcms_checkbox('check');
						}

						$('.espcms_fileupload_ok').unbind('click').bind('click', function () {
							var file_id = $(this).attr('id');
							dialog_selectFile(file_id);
						});

						$('.espcms_filedir_ok').unbind('click').bind('click', function () {
							var file_id = $(this).attr('file_id');
							dialog_diropen(file_id);
						});

						$(".espcms_file_dir").espcms_rightkey({
							data_id: 'file_id',
							data_name: 'filedir_id',
							items: [
								{'name': '[%pack:filemanage_pack-espcms_lable_myfiledir_editfieldir%]', 'cssname': 'espcms_tab_link', 'icon': 'espcms_icon_fa espcms_icon_fa-pencil-square-o', 'tab_close': 'false', 'tab_url': '[%$link.editdir%]'},
								{'name': '[%pack:filemanage_pack-espcms_lable_myfiledir_delfieldir%]', 'cssname': 'espcms_deldir', 'icon': 'espcms_icon_fa espcms_icon_fa-trash-o'},
								{'name': '[%pack:filemanage_pack-espcms_lable_myfiledir_mover%]', 'cssname': 'espcms_mover', 'icon': 'espcms_icon_fa espcms_icon_fa-retweet'}
							],
							callback: function () {
								delDir();
								fileMover();
								add_espcms_window_tab();
							}
						});
					}
				});
			}

			function delDir() {
				$('.espcms_deldir').click(function () {
					var data_id = $(this).attr('data-id');
					if (!data_id) {
						return false;
					}
					var dialog_html = '<div id="espcms_are_del_dialog" title="[%pack:public_pack-espcms_dialog_title%]" class="displaynone">' +
						'<p><span class="espcms_icon_fa espcms_icon_fa-exclamation-circle" style="float:left;margin:0 3px 0px 0;padding-top:4px;"></span>[%pack:public_pack-espcms_message_del_warning%]</p>' +
						'</div>';
					parent.$("body").append(dialog_html);
					var botton = [
						{
							text: "[%pack:botton_pack-espcms_botton_del_ok%]",
							class: "btn btn-danger",
							click: function () {
								$.ajax({
									type: "post",
									url: '[%$link.deldir%]',
									dataType: 'json',
									data: "filedir_id=" + data_id,
									beforeSend: function () {
										parent.espcms_are_loading();
									},
									success: function (data) {

										parent.$("#espcms_are_loading").dialog("close");
										parent.$.espcms_sticky(data.message, {'autoclose': 3500});
										var filedir_id = $('#filedir_id').val();
										dialog_diropen(filedir_id);
										$('.espcms_right_menu').remove();
									}
								});
								parent.$(this).dialog("close");
							}
						},
						{
							text: "[%pack:botton_pack-espcms_botton_del_no%]",
							class: "btn btn-lightgray",
							click: function () {
								parent.$(this).dialog("close");
								$('.espcms_right_menu').remove();
							}
						}
					];
					parent.espcms_public_dialog('espcms_are_del_dialog', botton);
					return false;
				});
			}

			function fileMover() {
				$('.espcms_mover').click(function () {
					var data_id = $(this).attr('data-id');
					if (!data_id) {
						return false;
					}
					var select_id_list = $('#select_id_list').val();
					if (!select_id_list) {
						return false;
					}
					$.ajax({
						type: "post",
						url: '[%$link.mover%]',
						dataType: 'json',
						data: "file_id=" + select_id_list + "&filedir_id=" + data_id,
						beforeSend: function () {
							parent.espcms_are_loading();
						},
						success: function (data) {

							parent.$("#espcms_are_loading").dialog("close");
							parent.$.espcms_sticky(data.message, {'autoclose': 3500});
							var filedir_id = $('#filedir_id').val();
							dialog_diropen(filedir_id);

							$('#select_id_list').val('');
							$('#select_filelist').val('');
							$('#select_titlelist').val('');
							$('#select_sizelist').val('');
							$('#select_extlist').val('');
						}
					});
				});
			}
		</script>
	</head>

	<body class="espcms_style_all">
		<div class="main">
			<div class="espcms_center_content_list vt">

				<div class="panel_list_button kill_copy">
					<div class="row">
						<div class="col-sm-9 pl15">
							[%if @this->power('addFileDir')%]
							<button type="button" class="btn btn-addblue btn-sm espcms_add_dir" tab_name="[%pack:filemanage_pack-espcms_lable_myfiledir_addfieldir%]" tab_close="false" tab_icon="glyphicons glyphicons-folder-plus"><span class="glyphicons glyphicons-folder-plus" aria-hidden="true"></span>[%pack:filemanage_pack-espcms_lable_myfiledir_addfieldir%]</button>
							[%/if%]
							[%if @this->power('uploadFile')%]
							<button type="button" id="picker" uploadurl="[%$upfileave%]" class="btn btn-green"><span class="glyphicons glyphicons-disk-open" aria-hidden="true"></span>[%pack:filemanage_pack-espcms_filenamage_file_dialog_title%]</button>
							[%/if%]
							[%if @this->power('delFile')%]
							<button type="button" class="btn btn-orange btn-sm espcms_del_file"><span class="espcms_icon_fa espcms_icon_fa-trash-o" aria-hidden="true"></span>[%pack:botton_pack-espcms_botton_del%]</button>
							[%/if%]
							<button type="button" class="btn btn-addblue btn-sm espcms_check_file"><span class="espcms_icon_fa espcms_icon_fa-stethoscope" aria-hidden="true"></span>[%pack:filemanage_pack-espcms_filenamage_file_check_title%]</button>
							<button type="button" class="btn btn-addblue btn-sm espcms_import_file" tab_name="[%pack:filemanage_pack-espcms_filenamage_file_import_title%]" tab_close="false" tab_icon="espcms_icon_fa espcms_icon_fa-retweet"><span class="espcms_icon_fa espcms_icon_fa-retweet" aria-hidden="true"></span>[%pack:filemanage_pack-espcms_filenamage_file_import_title%]</button>
							<button type="button" class="btn btn-lightgray btn-sm refresh"><span class="espcms_icon_fa espcms_icon_fa-refresh" aria-hidden="true"></span>[%pack:botton_pack-espcms_botton_refresh%]</button>
							<button type="button" data-type="listpic" class="espcms_list_type btn btn-sm btn-ironash"><span class="espcms_icon_fa espcms_icon_fa-th" aria-hidden="true"></span>[%pack:filemanage_pack-espcms_lable_myfiledir_pic%]</button>
							<button type="button" data-type="listfile" class="espcms_list_type btn btn-sm btn-ironash"><span class="espcms_icon_fa espcms_icon_fa-th-list" aria-hidden="true"></span>[%pack:filemanage_pack-espcms_lable_myfiledir_list%]</button>
						</div>
						<div class="col-sm-3">
							<form role="search" name="search_form" id="search_form">
								<input type="hidden" name="issearch" value="1"/>
								<input type="hidden" name="search_keyname" value="username"/>
								<div class="input-group input-group-sm">
									<input type="text" name="search_key" id="search_key" class="form-control" placeholder="[%pack:public_pack-espcms_lable_input_search_keyword%]"/>
									<span class="input-group-btn"><button class="btn btn-lightgray" type="submit">[%pack:botton_pack-espcms_botton_search%]</button></span>
								</div>
							</form>
						</div>
					</div>
				</div>
				<div class="panel">
					<form name="ajax_list" method="post" id="ajax_list">
						<input type="hidden" name="listurl" id="listurl" value="[%$link.index%]"/>
						<input type="hidden" name="loadname" id="loadname" value="#loadingstr"/>
						<input type="hidden" name="filedir_id" id="filedir_id" value="0"/>
						<input type="hidden" name="select_num" id="select_num" value="1000"/>

						<input type="hidden" name="select_id_list" id="select_id_list"/>
						<input type="hidden" name="select_filelist" id="select_filelist"/>
						<input type="hidden" name="select_fileurllist" id="select_fileurllist"/>
						<input type="hidden" name="select_titlelist" id="select_titlelist"/>
						<input type="hidden" name="select_sizelist" id="select_sizelist"/>
						<input type="hidden" name="select_extlist" id="select_extlist"/>

						<div id="loadingtable" class="displaynone"><div class="loading_pic"></div></div>
						<div class="panel-body pn myfiledir_list" id="loadingstr"></div>
					</form>
				</div>

			</div>
		</div>
		<script type="text/javascript" src="[%$ESPCMS_ADMIN_TEMPLATES_URL%]admin/fileupload.js"></script>
	</body>
</html>
